package com.lagou.sqlSession;



import com.lagou.config.XMLConfigurationBuilder;
import com.lagou.pojo.Configuration;
import org.dom4j.DocumentException;

import java.beans.PropertyVetoException;
import java.io.InputStream;

public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(InputStream inputStream) throws DocumentException, PropertyVetoException {
        XMLConfigurationBuilder xmlConfigurationBuilder = new XMLConfigurationBuilder();
        Configuration configuration = xmlConfigurationBuilder.parseConfig(inputStream);
        DefaultSqlSessionFactory defaultSqlSessionFactory = new DefaultSqlSessionFactory(configuration);
        return defaultSqlSessionFactory;
    }
}
